/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cc.model;

import java.io.Serializable;

/**
 *
 * @author gianmariospacagna
 */
public final class CurrencyRateKey implements Serializable {
    public String fromCurrency;
    public String toCurrency;

    public CurrencyRateKey() {}

    public CurrencyRateKey(String fromId, String toId) {
        this.fromCurrency = fromId;
        this.toCurrency = toId;
    }

    public boolean equals(Object otherOb) {
        if (this == otherOb) {
            return true;
        }
        if (!(otherOb instanceof CurrencyRateKey)) {
            return false;
        }
        CurrencyRateKey other = (CurrencyRateKey) otherOb;
        return (
                    (fromCurrency==null?other.fromCurrency==null:fromCurrency.equals
                    (other.fromCurrency)
                    )
                    &&
                    (toCurrency == other.toCurrency)
                );
    }

    public int hashCode() {
        int hash = 0;
        hash += (fromCurrency != null ? fromCurrency.hashCode() : 0);
        hash += (toCurrency != null ? toCurrency.hashCode() : 0);
        return hash;
    }

    public String toString() {
        return "" + fromCurrency + "-" + toCurrency;
    }
}
